<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:forEach items="${baoFeiBMList }" var="u">													
	<tr>
		<td><input type="checkbox" name="bmbfId" value="${u.id }"></td>
		<td><fmt:formatDate value="${u.baoFei.shenQingRQ }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		<td>${u.baoFei.wuZi.ziChanBH }</td>
		<td>${u.baoFei.wuZi.wuZiMC }</td>														
		<td>${u.baoFei.wuZi.chanPinXLH }</td>
		<td>
		<c:choose>
			<c:when test="${u.baoFei.baoFeiLX==1 }">
				到年限
			</c:when>
			<c:when test="${u.baoFei.baoFeiLX==2 }">
				损坏不可用
			</c:when>
		</c:choose>
		</td>
		<td>${u.baoFei.baoFeiYY }</td>
		<td>
			<a href="${ctx }/wuzi/wuZiDetail.do?id=${u.baoFei.wuZi.id}" target="_blank" class="btn default btn-xs green-stripe">物资详情</a>&nbsp;&nbsp;
			<a href="${ctx }/wuzi/baoFeiDetail.do?id=${u.baoFei.id}" target="_blank" class="btn default btn-xs green-stripe">流程详情</a>
		</td>
		<td>
			<a href="javascript:baoFeiBuMenSP('${u.id}', '${u.baoFei.huanJie.id}')" class="btn default btn-xs green-stripe">同意</a>&nbsp;&nbsp;
			<a href="${ctx }/wuzi/baoFeiBTY.do?id=${u.id}" target="_blank" class="btn default btn-xs green-stripe">不同意</a>
		</td>
	</tr>
</c:forEach>
<script>
    function baoFeiBuMenSP(id, huanJie) {
        var url = '/wuzi/baoFeiBuMenSP.do';
        if (huanJie == '717') {
			url = '/wuzi/baofeidan/gkbmsptySave.do';
		}

        $.ajax({
            type:"POST",
            url:"${ctx}" + url,
            dataType:"json",
            data:{
                "id":id
            },
            async:false,
            success:function(data){
                if(data.result=="success"){
                    alert('您同意部门物资报废！');
                    var aurl = '/wuzi/bmspList.do';
                    if (huanJie == '717') {
                        aurl = '/wuzi/gkbmspList.do'
                    }
                    $.ajax({
                        type:"POST",
                        url:"${ctx}" + aurl,
                        dataType:"html",
                        success:function(data){
                            if (huanJie == '717') {
                                $("#gkbmsp").html(data);
                            } else {
                                $("#bmsp").html(data);
                            }
                        }
                    });
                }
            }
        });
    }
</script>